knitr::opts_chunk$set(echo = TRUE)

library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.0.2
## -- Attaching packages --------------------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2     v purrr   0.3.4
## v tibble  3.0.3     v dplyr   1.0.0
## v tidyr   1.1.0     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.5.0
## Warning: package 'ggplot2' was built under R version 4.0.2
## Warning: package 'tibble' was built under R version 4.0.2
## Warning: package 'tidyr' was built under R version 4.0.2
## Warning: package 'readr' was built under R version 4.0.2
## Warning: package 'purrr' was built under R version 4.0.2
## Warning: package 'dplyr' was built under R version 4.0.2
## Warning: package 'stringr' was built under R version 4.0.2
## Warning: package 'forcats' was built under R version 4.0.2
## -- Conflicts ------------------------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(here)
## Warning: package 'here' was built under R version 4.0.2
## here() starts at C:/Users/atredennick/repos/COVID-stochastic-fitting
allfiles <- list.files("../output/current/", ".csv")

for(f in allfiles) {
  fname <- paste0("../output/current/",f)
dat <- read.csv(fname) %>%
  filter(variable %in% c("actual_daily_cases")) %>%
  mutate(date = as.Date(date))

read.csv(fname) %>%
  filter(variable %in% c("daily_cases")) %>%
  filter(sim_type == "status_quo") %>%
  mutate(date = as.Date(date)) %>%
  filter(date <= (Sys.Date() + 7*4)) %>%
  ggplot(aes(x = date, y = median_value)) +
  geom_ribbon(aes(ymin = lower_80, ymax = upper_80), alpha = 0.2) +
  geom_line() +
  geom_line(data = dat, aes(x = date, y = mean_value), color = "blue") +
  ylab("daily cases") +
  ggtitle(f) -> out
print(out)

dat <- read.csv(fname) %>%
  filter(variable %in% c("actual_daily_deaths")) %>%
  mutate(date = as.Date(date))
read.csv(fname) %>%
  filter(variable %in% c("daily_deaths")) %>%
  filter(sim_type == "status_quo") %>%
  mutate(date = as.Date(date)) %>%
  filter(date <= (Sys.Date() + 7*4)) %>%
  ggplot(aes(x = date, y = median_value)) +
  geom_ribbon(aes(ymin = lower_80, ymax = upper_80), alpha = 0.2) +
  geom_line() +
  ylab("daily deaths") +
  geom_line(data = dat, aes(x = date, y = mean_value), color = "blue") +
  ggtitle(f) -> out3
print(out3)

read.csv(fname) %>%
  filter(variable %in% c("combined_trend", "latent_trend", "mobility_trend")) %>%
  filter(sim_type == "status_quo") %>%
  mutate(date = as.Date(date)) %>%
  ggplot(aes(x = date, y = mean_value)) +
  geom_point(aes(color = variable)) +
  ggtitle(f) -> out2
print(out2)
}

## Warning: Removed 9 row(s) containing missing values (geom_path).

## Warning: Removed 1 row(s) containing missing values (geom_path).

## Warning: Removed 10 row(s) containing missing values (geom_path).

## Warning: Removed 17 row(s) containing missing values (geom_path).

## Warning: Removed 9 row(s) containing missing values (geom_path).

## Warning: Removed 10 row(s) containing missing values (geom_path).

## Warning: Removed 13 row(s) containing missing values (geom_path).

## Warning: Removed 3 row(s) containing missing values (geom_path).

## Warning: Removed 8 row(s) containing missing values (geom_path).

## Warning: Removed 10 row(s) containing missing values (geom_path).

## Warning: Removed 26 row(s) containing missing values (geom_path).

## Warning: Removed 16 row(s) containing missing values (geom_path).

## Warning: Removed 14 row(s) containing missing values (geom_path).

## Warning: Removed 9 row(s) containing missing values (geom_path).

## Warning: Removed 20 row(s) containing missing values (geom_path).

## Warning: Removed 9 row(s) containing missing values (geom_path).

## Warning: Removed 9 row(s) containing missing values (geom_path).

## Warning: Removed 9 row(s) containing missing values (geom_path).

## Warning: Removed 21 row(s) containing missing values (geom_path).

## Warning: Removed 14 row(s) containing missing values (geom_path).

## Warning: Removed 7 row(s) containing missing values (geom_path).

## Warning: Removed 18 row(s) containing missing values (geom_path).

## Warning: Removed 16 row(s) containing missing values (geom_path).

## Warning: Removed 14 row(s) containing missing values (geom_path).

## Warning: Removed 8 row(s) containing missing values (geom_path).

## Warning: Removed 22 row(s) containing missing values (geom_path).

## Warning: Removed 15 row(s) containing missing values (geom_path).

## Warning: Removed 1 row(s) containing missing values (geom_path).

## Warning: Removed 21 row(s) containing missing values (geom_path).

## Warning: Removed 7 row(s) containing missing values (geom_path).

## Warning: Removed 20 row(s) containing missing values (geom_path).

## Warning: Removed 12 row(s) containing missing values (geom_path).

## Warning: Removed 13 row(s) containing missing values (geom_path).

## Warning: Removed 7 row(s) containing missing values (geom_path).

## Warning: Removed 16 row(s) containing missing values (geom_path).

## Warning: Removed 13 row(s) containing missing values (geom_path).

## Warning: Removed 15 row(s) containing missing values (geom_path).

## Warning: Removed 13 row(s) containing missing values (geom_path).

## Warning: Removed 29 row(s) containing missing values (geom_path).

## Warning: Removed 13 row(s) containing missing values (geom_path).

## Warning: Removed 12 row(s) containing missing values (geom_path).

## Warning: Removed 19 row(s) containing missing values (geom_path).

## Warning: Removed 14 row(s) containing missing values (geom_path).

## Warning: Removed 9 row(s) containing missing values (geom_path).

## Warning: Removed 15 row(s) containing missing values (geom_path).

## Warning: Removed 11 row(s) containing missing values (geom_path).

## Warning: Removed 36 row(s) containing missing values (geom_path).

## Warning: Removed 10 row(s) containing missing values (geom_path).

## Warning: Removed 17 row(s) containing missing values (geom_path).

## Warning: Removed 21 row(s) containing missing values (geom_path).